package com.jcl.core.constants;

import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Set;

/**
 * @ClassName ChannelSource
 * @Description TODO
 * @Author yyliu
 * @Date 2018/9/25 16:35
 * @Version 1.0
 **/
public class ChannelSourceConstant {

    public static final String ZHAOPIN                           = "zhaopin";
    public static final String _51JOB                            = "51job";
    public static final String LAGOU                             = "lagou";
    public static final String DAJIE                             = "dajie";
    public static final String LIEPIN                            = "liepin";
    public static final String ZHIPIN                            = "zhipin";

    public static final String CRAWLER_ZHAOPIN                   = "zhaopin";
    public static final String CRAWLER_51JOB                     = "51job";
    public static final String CRAWLER_LAGOU                     = "lagou";
    public static final String CRAWLER_DAJIE                     = "dajie";
    public static final String CRAWLER_LIEPIN                    = "liepin";
    public static final String CRAWLER_ZHIPIN                    = "zhipin";

    public static final Map<String, String> sourceMap    = new LinkedHashMap<>();
    public static final Map<String, String> crawlerSourceMap    = new LinkedHashMap<>();

    public static final Set<String> sources;

    static{
        sourceMap.put(ZHAOPIN, "智联招聘");
        sourceMap.put(_51JOB, "前程无忧");
        sourceMap.put(LAGOU, "拉钩");
        sourceMap.put(DAJIE, "大街");
        sourceMap.put(LIEPIN, "猎聘");
        sourceMap.put(ZHIPIN, "BOSS直聘");

        sources = sourceMap.keySet();

        crawlerSourceMap.put(ZHAOPIN, CRAWLER_ZHAOPIN);
        crawlerSourceMap.put(_51JOB, CRAWLER_51JOB);
        crawlerSourceMap.put(LAGOU, CRAWLER_LAGOU);
        crawlerSourceMap.put(DAJIE, CRAWLER_DAJIE);
        crawlerSourceMap.put(LIEPIN, CRAWLER_LIEPIN);
        crawlerSourceMap.put(ZHIPIN, CRAWLER_ZHIPIN);
    }

    /* *
     * @Author yyliu
     * @Description //TODO
     * @Date 16:41 2018/9/25
     * @Param [source]
     * @return boolean
     **/
    public static boolean hasSource(String source){
        return sources.contains(source) ? true : false;
    }

}
